home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / wc15_b.arc / DLGDEMO1.WMS < prev    next >
Text File  |  1991-03-22  |  26KB  |  723 lines

  1. ;First dialog box demo Macro
  2.  
  3. STOP
  4.  
  5. list1$ = "list2.txt"
  6. var1$ = ""
  7. var10$ = "~~temp.txt"
  8. STOP
  9. CLEAR
  10. macro$ = GETSESSSTR(28)
  11. CHGDIR(macro$)
  12. MACROHALT(1)
  13.  
  14.   m0 = menubar?
  15.   m1 = addbar
  16.         addcommand(m1,2,"&WinComm Menu")
  17.   sm1 = addmenu(m1,"&Dialog Boxes")
  18.         addcommand(sm1,3,"F&LIST && VTEXT")
  19.         addcommand(sm1,4,"&File Selection")
  20.         addcommand(sm1,5,"M&ail")
  21.         addcommand(sm1,6,"&Other Samples")
  22.   sm2 = addmenu(m1,"&Graphic Menu")
  23.         addcommand(sm2,7,"Maps")
  24. step
  25. showbar(m1)
  26.  
  27.    DIALOGBOX 71, 20, 235, 107, 21, "Graphics - Menu Bar - Dialog Boxes"
  28.       LTEXT 7, 10, 219, 33, "This part of the TOUR will demonstrate several methods WinComm provides for data entry and option selection.  Notice the Menu Bar has changed to allow different selections in this part of the Tour."
  29.       LTEXT 7, 42, 221, 33, "Select each menu item and explore the many capabilities of WinComm.  When you are finished, select WinComm Menu to halt this macro and redisplay WinComms normal Menu Bar."
  30.       DEFCANCELBUTTON 90, 81, 50, 14, "&OK"
  31.    DEND
  32. DO i = DIALOG? UNTIL(i != 255)
  33.  
  34. main_loop:
  35.   i = menu?
  36.   if(i==2) gosub win_return
  37.   else if(i==3) gosub flist_vtext
  38.   else if(i==4) gosub fil_sel
  39.   else if(i==5) gosub mail
  40.   else if(i==6) gosub next
  41.   else if(i==7) gosub maps
  42. GOTO main_loop
  43.  
  44. ;******  Dialog Boxes|FLIST & VTEXT  *
  45.  
  46. flist_vtext:
  47.  
  48.    DIALOGBOX 10, 14, 274, 162, 17
  49.       CTEXT 86, 6, 77, 9, "Dialog Box Example"
  50.       LTEXT 12, 15, 234, 19, "This dialog box is used to demonstrate the various types of controls that can be used within WinComm dialog boxes."
  51.       FLISTBOX 8, 63, 155, 33, LIST1$, VAR2$
  52.       LTEXT 12, 37, 151, 24, "This is a File Linked List box which displays a list of items contained in a text file."
  53.       LTEXT 11, 98, 153, 40, "When an Item is selected in the list box, the value of DIALOG? changes and the selected text is assigned to a variable.  This Macro places that string in the Variable Text box below."
  54.       VTEXT 10, 143, 150, 9, VAR2$
  55.       LTEXT 170, 36, 89, 17, "The list displayed is contained in the file:"
  56.       VTEXT 180, 57, 63, 10, LIST1$
  57.       GROUPBOX 166, 30, 1, 126, ""
  58.       LTEXT 171, 70, 87, 31, "which the Macro can change by selecting the Update Pushbutton below."
  59.       GROUPBOX 7, 30, 261, 5, ""
  60.       UPDATEPB 177, 105, 78, 14, "&Update Pushbutton"
  61.       DEFPUSHBUTTON 177, 136, 78, 14, "&OK"
  62.       GROUPBOX 170, 123, 98, 5, ""
  63.       GROUPBOX 9, 136, 153, 18, ""
  64.       GROUPBOX 177, 49, 69, 20, ""
  65.    DEND
  66.  
  67. test:                   ;DIALOG? returns 255 while there is no activity in the 
  68.                         ;dialog box.  DIALOG? is reset each time it is tested
  69. DO                      ;so its value must be assigned to a variable for processing
  70. i = DIALOG?             ;If a pushbutton is selected or something in a list box
  71. UNTIL(i != 255)         ;is selected, the value will change and the macro 
  72.                         ;will fall through this loop
  73.  
  74.  
  75.                 ;code below tests for the selection of an UPDATEPUSHBUTTON
  76.                 ;DIALOG? returns 100 for the first  UPDATEPUSHBUTTON
  77.                 ;101 for the second up to a maximum of 103 for the fourth
  78. IF(i == 100){                                                           
  79.     IF(CMP(list1$,"list2.txt") == FALSE)list1$ = "list2.txt"
  80.         ELSE list1$ = "list1.txt"
  81.         UPDATEDLG(17)           ;Updates both the VETEXT and LIST BOX
  82.         GOTO test
  83. }
  84.  
  85.                 ;Tests for a selection in the List Box 
  86.                 ;DIALOG? returns 200 for the first  (F)LISTBOX
  87.                 ;101 for the second up to a maximum of 103 for the fourth
  88. IF(i == 200){
  89.         UPDATEDLG(16)           ;Updates only VETEXT
  90.         GOTO test
  91. }
  92. RETURN                ;goes back to menu processing if neither the UPDATEPB or LISTBOX selected
  93.  
  94. ;***** Dialog Boxes|File Selection **
  95. fil_sel:
  96.  
  97.    ftmp$ = "dlgdmo.fil"
  98.    b$ = "AGNY.DOC"
  99.    fdescr$ = "General Information - Directory of Oklahoma Agencies"    ;causes this item to be
  100.                                     ;selected in the list box
  101.  
  102.    DIALOGBOX 57, 10, 199, 194, 17
  103.       CTEXT 45, 4, 108, 8, "Files Available on ORIGINS:"
  104.       CTEXT 96, 13, 71, 9, "File Description:"
  105.       VTEXT 77, 26, 115, 54, FDESCR$
  106.       UPDATEPB 29, 97, 62, 14, "&Receive File"
  107.       UPDATEPB 111, 97, 62, 14, "&Cancel"
  108.       FLISTBOX 8, 25, 64, 65, FTMP$, B$
  109.       LTEXT 5, 121, 190, 41, "This is an example of one use of the FLISTBOX and the code required to update the description when a file is selected.  Select different files and notice the discription change.  The pushbuttons above are not active."
  110.       DEFPUSHBUTTON 65, 169, 69, 14, "&OK"
  111.       CTEXT 20, 13, 41, 9, "File Name:"
  112.       GROUPBOX 7, 111, 186, 5, ""
  113.       GROUPBOX 75, 21, 120, 60, ""
  114.    DEND
  115.  
  116. testy:          
  117.                 
  118. DO i = DIALOG? UNTIL(i != 255)    ;this line has 3 statements but works just like the three lines
  119.                 ;under the label "test"
  120.  
  121. IF(i == 100){        ;UPDATEPB pressed but don't do anything
  122. UPDATEDLG(0)        ;resets DIALOG?
  123. GOTO testy
  124. }
  125. IF(i == 101){        ;the other UPDATEPB pressed but don't do anything
  126. UPDATEDLG(0)            ;resets DIALOG?
  127. GOTO testy
  128. }
  129.                 
  130. IF(i == 200){            ;file selected in list box,
  131. fdescr$ = EXTRACT(CHAR(9),b$,2)    ;extract description and display it.  
  132. UPDATEDLG(16)            ;Updates VETEXT
  133. GOTO testy
  134. }
  135. return            ;go back to menu processing
  136.  
  137. ;**** Dialog Boxes|Mail **
  138. mail:
  139.  
  140. date$ = left(strtime(time?),10)
  141. time$ = mid(strtime(time?),12,8)
  142. mail$ = "mail.txt"
  143. TO$ = ""
  144. SUBJ$ = ""
  145.  
  146.    DIALOGBOX 53, 10, 230, 212, 17
  147.       LTEXT 103, 4, 18, 9, "Mail"
  148.       RTEXT 18, 18, 21, 9, "To:"
  149.       EDIT 40, 15, 175, 13, TO$
  150.       RTEXT 7, 33, 32, 9, "Subject:"
  151.       EDIT 40, 31, 175, 13, SUBJ$
  152.       RTEXT 19, 49, 20, 9, "Date:"
  153.       EDIT 40, 47, 75, 13, DATE$
  154.       RTEXT 119, 49, 20, 9, "Time:"
  155.       EDIT 140, 47, 75, 13, TIME$
  156.       SEDIT 8, 64, 216, 57, MAIL$
  157.       DEFPUSHBUTTON 36, 123, 71, 15, "&Save"
  158.       CANCELBUTTON 123, 123, 72, 15, "&Discard"
  159.       GROUPBOX 5, 138, 221, 5, ""
  160.       LTEXT 9, 143, 212, 35, "This dialog box shows two other types of controls. The framed rectangles are EDIT boxes and allow text entry and editing.  The box with the vertical scroll bar is also an EDIT box but its contents are stored in a disk file which can be"
  161.       LTEXT 9, 175, 210, 35, "up to 16,000 characters in length.  Create a mail message by filling in the blanks and check the SAVE button.  After this dialog box disappears the Macro will display one of WinComms 'stock' dialog boxes for naming the mail file."
  162.    DEND
  163.  
  164. DO i = DIALOG? UNTIL(i != 255)
  165.  
  166. IF(i == 0){
  167.    DIALOGBOX 77, 21, 154, 87, 17
  168.       LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time?  If you haven't saved one yet you won't be able to read it later in the demonstration."
  169.       DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail"
  170.       CANCELBUTTON 24, 62, 100, 14, "&Lets Go On"
  171.    DEND
  172.         DO j = DIALOG? UNTIL(j != 255)
  173.         IF(j == 0)RETURN            ;go back to menu processing
  174.         ELSE GOTO mail
  175. }
  176. ELSE IF(i == 1){
  177.  
  178.  
  179.         mail_mess = FOPEN(4096,"~~temp.txt")    ;create a temp file
  180.  
  181.         mail = FOPEN(2,mail$)              ;open the file created by the SEDIT box
  182.         FWRITELN(mail_mess,to$)                  ;add information to the temp file
  183.         FWRITELN(mail_mess,subj$)
  184.         FWRITELN(mail_mess,date$)
  185.         FWRITELN(mail_mess,time$)
  186.         DO
  187.         str$ = FREAD(mail,255)          ;copy the mail file to the temp file for display
  188.         FWRITE(mail_mess,255,str$)
  189.         UNTIL(NULL(str$) == TRUE)        ;everything copied
  190.         FCLOSE(mail_mess)
  191.         FCLOSE(mail)
  192.         DELETEFILE("mail.txt")
  193.         a$ = ".MLE"
  194.                 IF(SAVEASDLG("Save Mail Message as what File Name",a$) == FALSE){
  195.                    DIALOGBOX 77, 21, 154, 87, 17
  196.                       LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time?  If you haven't saved one yet you won't be able to read it later in the demonstration."
  197.                       DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail"
  198.                       CANCELBUTTON 24, 62, 100, 14, "&Lets Go On"
  199.                    DEND
  200.                    DO j = DIALOG? UNTIL(j != 255)
  201.                    IF(j == 0){
  202.             DELETEFILE("~~temp.txt")
  203.             RETURN
  204.            }
  205.                    ELSE GOTO mail
  206.                 }
  207.                 ELSE RENAME("~~temp.txt",a$)
  208. }
  209.  
  210. IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE)RETURN  ;cancel selected go back to menu
  211. GOSUB extractit
  212. var11$ = "~~temp.txt"
  213.    DIALOGBOX 53, 10, 230, 202, 17
  214.       LTEXT 103, 4, 18, 9, "Mail"
  215.       RTEXT 18, 18, 21, 9, "To:"
  216.       VTEXT 43, 18, 175, 9, TO$
  217.       RTEXT 7, 33, 32, 9, "Subject:"
  218.       VTEXT 43, 33, 175, 9, SUBJ$
  219.       RTEXT 19, 49, 20, 9, "Date:"
  220.       VTEXT 42, 49, 72, 9, DATE$
  221.       RTEXT 119, 49, 20, 9, "Time:"
  222.       VTEXT 143, 49, 75, 9, TIME$
  223.       STEXT 10, 62, 215, 58, VAR11$
  224.       UPDATEPB 36, 123, 71, 15, "&Read Another"
  225.       CANCELBUTTON 123, 123, 72, 15, "&Finished"
  226.       GROUPBOX 5, 138, 221, 5, ""
  227.       LTEXT 9, 144, 212, 33, "This is an example of a dialog box for reading mail.  The text box with the vertical scroll bar in this case is a STEXT box which is read only.  The [Read Another] button is an UPDATEPB which displays a 'Stock Dialog Box' that allows"
  228.       LTEXT 9, 176, 210, 24, "selection of another Mail file.  When the new mail file is selected, this dialog box is updated with the information in the selected file."
  229.       GROUPBOX 40, 12, 183, 16, ""
  230.       GROUPBOX 40, 27, 183, 16, ""
  231.       GROUPBOX 141, 43, 82, 16, ""
  232.       GROUPBOX 40, 43, 77, 16, ""
  233.    DEND
  234. read_mail:
  235. DO i = DIALOG? UNTIL(i != 255)
  236. IF(i == 100){
  237.         DELETEFILE("~~temp.txt")   ;make for shure we get rid of that temp file
  238.         IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE){
  239.         GOTO read_mail
  240.         }
  241.         GOSUB extractit
  242.         GOTO read_mail
  243.  
  244. }
  245. DELETEFILE("~~temp.txt")        ;that temp file better be gone by now!!!
  246. RETURN                ;finished--back to menu processing
  247.  
  248.  
  249. ;***** Subroutine **
  250.  
  251.  
  252. extractit:                        ;Subroutine to remove information fron the front of the mail file
  253.                                 ;for display in the Read Mail Dialog box.
  254. mail = FOPEN(2,var2$)           ;open the file selected in the FILEOPENDLG dialog box
  255. to$ = FREADLN(mail)             ;extract information from the mail file and assign
  256. subj$ = FREADLN(mail)           ;to the proper variables
  257. date$ = FREADLN(mail)           
  258. time$ = FREADLN(mail)
  259. mail_mess = FOPEN(4096,"~~temp.txt")
  260. DO
  261.         str$ = FREAD(mail,255)          ;copy the rest of the mail file to a temprary file for display
  262.         FWRITE(mail_mess,255,str$)
  263. UNTIL(NULL(str$) == TRUE)
  264. FCLOSE(mail)
  265. FCLOSE(mail_mess)
  266. UPDATEDLG(18)
  267. RETURN
  268.  
  269. ;****** Dialog Boxes|Other Samples **
  270. next:
  271. var1$ = ""
  272. spec$ = "spec.txt;20 30 40"    ;assign the variable for the file to display in the FLIST box
  273.  
  274.    DIALOGBOX 90, 15, 185, 181, 17
  275.       LTEXT 52, 6, 81, 9, "Your current status"
  276.       GROUPBOX 10, 13, 164, 35, "In training"
  277.       CHECKBOX 19, 24, 42, 10, "Intern", VAR1
  278.       CHECKBOX 19, 36, 49, 10, "Resident", VAR2
  279.       CHECKBOX 90, 24, 66, 10, "Chief resident", VAR3
  280.       CHECKBOX 90, 36, 47, 10, "Fellow", VAR4
  281.       GROUPBOX 10, 50, 164, 48, "In practice"
  282.       CHECKBOX 19, 61, 71, 10, "Administration", VAR5
  283.       CHECKBOX 19, 73, 46, 10, "Academic", VAR6
  284.       CHECKBOX 19, 86, 56, 10, "Military", VAR7
  285.       CHECKBOX 90, 61, 68, 10, "Private/group", VAR8
  286.       CHECKBOX 90, 73, 68, 10, "Locum tenens", VAR9
  287.       CHECKBOX 90, 86, 83, 10, "Contract Professional", VAR10
  288.       CHECKBOX 10, 105, 43, 10, "Other...", VAR11
  289.       EDIT 56, 103, 118, 12, VAR1$
  290.       LTEXT 48, 118, 93, 9, "Select your specialty"
  291.       FLISTBOX 10, 128, 166, 32, SPEC$, VAR2$
  292.       DEFPUSHBUTTON 54, 157, 77, 14, "&OK"
  293.    DEND
  294. cont1:
  295. DO dg = dialog? UNTIL(dg != 255)
  296. IF(DG == 200){            ;something selected in list box but we don't do anything with it here
  297. UPDATEDLG(0)
  298. GOTO cont1
  299. }
  300. ELSE return            ;finished with this, process those menus
  301.  
  302. ;****** WinComm Menu **
  303. win_return:        ;somebody wants to go back to wincomms menu
  304. SHOWBAR(m0)
  305. i = GETSESSINT(68)
  306. PUTSESSINT(68,0)            ; disable auto sizing
  307. OPEN("TOUR.WSF","",1)
  308. PUTSESSINT(68,i)            ; disable auto sizing
  309. HALT
  310. ;******* Graphic Menu|Maps **
  311. maps:
  312. ENABLEMENU(m1,2,1)    ;disable all menu items while running the hotspot program
  313. ENABLEMENU(m1,3,1)    ;the menus do not need to be disabled and could be fully
  314. ENABLEMENU(m1,4,1)    ;functional, as the macro could continue to process MENU? 
  315. ENABLEMENU(m1,5,1)    ;but for a demo what do you want?
  316. ENABLEMENU(m1,6,1)
  317. ENABLEMENU(m1,7,1)
  318. SHOWBAR(m1)
  319. show(1)
  320. i = GETSESSINT(68)
  321. PUTSESSINT(68,0)
  322. OPEN("GRAPHIC.WSF","",0)
  323. PUTSESSINT(68,i)
  324.    DIALOGBOX 87, 27, 201, 106, 21, "Button and Graphics Demo"
  325.       LTEXT 16, 9, 169, 25, "This part of the Tour will allow you to make selections of Cities and States from a map."
  326.       LTEXT 17, 40, 165, 34, "Select a region, then select Cities and States by clicking on the names.  Click on USA Map then Complete to finish this part of the demo."
  327.       DEFPUSHBUTTON 73, 79, 50, 14, "OK"
  328.    DEND
  329. DO i = DIALOG? UNTIL(i != 255)
  330.  
  331. FCLOSE(FOPEN(4096,macro$+"\fill.txt"))    ;create a file called fill.txt
  332. Var1$ = macro$+"\fill.txt"
  333. first = 1
  334. vra2$ = ""
  335.  
  336.  
  337. USA:
  338. DELOBJECT(0,0,0)
  339. USERWINDOW(5,0,100,16776960)
  340. METABKG(0,0,1,"us_color.wmf")
  341.     BUTTON(-81,2459,1258,590,"1001,&WEST")
  342.     BUTTON(2016,2276,1259,590,"1002,MOU&NTAIN")
  343.     BUTTON(4208,3089,1259,570,"1003,&PLAINS")
  344.     BUTTON(3708,5366,1258,589,"1004,&TEXAS")
  345.     BUTTON(825,7439,1259,589,"1005,&ALASKA")
  346.     BUTTON(4357,8455,1259,590,"1006,&HAWAII")
  347.     BUTTON(6179,2707,1258,586,"1007,MID&WEST")
  348.     BUTTON(6101,4951,1257,586,"1008,SO&UTH")
  349.     BUTTON(8035,1488,1415,585,"1009,NO&RTHEAST")
  350.     BUTTON(7930,3496,1420,589,"1010,S&OUTHEAST")
  351. SHOW(6)
  352.  
  353. if(first==1){
  354.       first = 0
  355.       GOTO us_test
  356. }
  357.                     ;will come here if we have already been to the regions
  358. Var2$ = ""
  359.    DIALOGBOX 60, 12, 207, 170, 17
  360.       LTEXT 55, 5, 108, 9, "States and Metros Selected"
  361.       FLISTBOX 8, 20, 90, 140, VAR1$, VAR2$
  362.       DEFPUSHBUTTON 130, 123, 47, 14, " &Complete "
  363.       PUSHBUTTON 130, 65, 47, 14, "&USA "
  364.       LTEXT 103, 33, 82, 9, "To return to USA map  "
  365.       LTEXT 103, 42, 94, 9, "for additional regional "
  366.       LTEXT 103, 50, 76, 9, "selections..."
  367.       LTEXT 103, 97, 93, 9, "When no more selections "
  368.       LTEXT 103, 106, 58, 9, "are desired..."
  369.    DEND
  370. cont_it:
  371. DO dg = DIALOG? UNTIL(dg != 255)
  372. if(dg==1) GOTO exit
  373. if(dg==200){
  374.         UPDATEDLG(0)
  375.         GOTO cont_it
  376. }
  377. us_test:
  378. i = object?
  379. IF(i == 1001) goto nope       ;this is where we test to see which hotspot has been selected
  380. ELSE IF(i == 1002) goto Mountain  ;just like processing menus
  381. ELSE IF(i == 1003) goto Plains 
  382. ELSE IF(i == 1004) goto nope 
  383. ELSE IF(i == 1005) goto AK_HI
  384. ELSE IF(i == 1006) goto AK_HI
  385. ELSE IF(i == 1007) goto nope
  386. ELSE IF(i == 1008) goto nope
  387. ELSE IF(i == 1009) goto NE
  388. ELSE IF(i == 1010) goto nope
  389.  
  390. goto us_test
  391.  
  392.  
  393. ;------------------------------------------------P L A I N S --------------------------------------
  394. plains:
  395. DELOBJECT(0,0,0)
  396. USERWINDOW(5,0,100,16776960)
  397. METABKG(0,0,1,"plains.wmf")
  398.     BUTTON(1352,1291,1258,608,"1001,&Fargo")
  399.     BUTTON(896,481,472,608,"1002,ND")
  400.     BUTTON(3019,1595,2217,608,"1003,Minneapolis-St. Paul")
  401.     BUTTON(3176,684,472,607,"1004,MN")
  402.     BUTTON(1038,2557,471,608,"1006,SD")
  403.     BUTTON(849,3873,472,608,"1009,NE")
  404.     BUTTON(1447,5823,471,607,"1017,KS")
  405.     BUTTON(3129,8177,472,608,"1020,OK")
  406.     BUTTON(3805,7595,472,608,"1022,AR")
  407.     BUTTON(3711,5139,471,608,"1015,MO")
  408.     BUTTON(3318,3899,471,607,"1011,IA")
  409.     BUTTON(1541,2684,1258,607,"1005,Sioux Falls")
  410.     BUTTON(1682,3924,1258,608,"1007,Omaha")
  411.     BUTTON(2154,5722,1337,607,"1012,Kansas City")
  412.     BUTTON(1289,6506,1258,608,"1016,Wichita")
  413.     BUTTON(1226,8380,1651,607,"1019,Oklahoma City")
  414.     BUTTON(2358,7139,1258,608,"1018,Tulsa")
  415.     BUTTON(4544,7949,1258,608,"1021,Little Rock")
  416.     BUTTON(3679,5899,1258,607,"1013,St. Louis")
  417.     BUTTON(3947,4203,1320,607,"1010,Des Moines")
  418.     BUTTON(1226,4658,1258,608,"1008,Lincoln")
  419.     BUTTON(4371,6608,1258,607,"1014,Springfield")
  420. SHOW(6)
  421.  
  422.    DIALOGBOX 275, 20, 159, 70, 28, "States and Metros"
  423.       LTEXT 30, 4, 108, 8, "States and Metros Selected"
  424.       FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$
  425.       PUSHBUTTON 103, 22, 49, 14, "Remove "
  426.       PUSHBUTTON 103, 44, 49, 14, "USA Map"
  427.    DEND
  428.  
  429. plains_test:
  430. dg = DIALOG?            ;processing both dialog box and hotspot selection
  431. i = OBJECT?
  432. IF(i>0) goto get_HS1        ;a hotspot selected go find which one
  433. IF(dg==255) goto plains_test
  434. IF(dg==200){            ;something selected in list box. we just go back and look for
  435.         UPDATEDLG(0)        ;another selection.  var2$ now has the selection if we want to 
  436.         GOTO Plains_test        ;
  437. }                ;
  438. IF(dg==2){            ;remove it here
  439.     GOSUB remove
  440.     GOTO plains_test
  441. }
  442. DESTROYDLG            ;since this is a modless dialog box we must destroy it if either
  443.                 ;of the other pushbuttons are selected
  444. GOTO USA            ;redisplay the US map
  445.  
  446.  
  447. get_HS1:
  448.  
  449. IF(i == 1001) Var2$ = "ND-Fargo"
  450. ELSE IF(i == 1002)  Var2$ ="ND NORTH DAKOTA"
  451. ELSE IF(i == 1003)  Var2$ ="MN-Minneapolis/St. Paul"
  452. ELSE IF(i == 1004)  Var2$ ="MN MINNESOTA"
  453. ELSE IF(i == 1005)  Var2$ ="SD-Sioux Falls"
  454. ELSE IF(i == 1006)  Var2$ ="SD SOUTH DAKOTA"
  455. ELSE IF(i == 1007)  Var2$ ="NE-Omaha"
  456. ELSE IF(i == 1008)  Var2$ ="NE-Lincoln"
  457. ELSE IF(i == 1009)  Var2$ ="NE NEBRASKA"
  458. ELSE IF(i == 1010)  Var2$ ="IA-Des Moines"
  459. ELSE IF(i == 1011)  Var2$ ="IA IOWA"
  460. ELSE IF(i == 1012)  Var2$ ="MO-Kansas City"
  461. ELSE IF(i == 1013)  Var2$ ="MO-St. Louis"
  462. ELSE IF(i == 1014)  Var2$ ="MO-Springfield"
  463. ELSE IF(i == 1015)  Var2$ ="MO MISSOURI"
  464. ELSE IF(i == 1016)  Var2$ ="KS-Wichita"
  465. ELSE IF(i == 1017)  Var2$ ="KS KANSAS"
  466. ELSE IF(i == 1018)  Var2$ ="OK-Tulsa"
  467. ELSE IF(i == 1019)  Var2$ ="OK-Oklahoma City"
  468. ELSE IF(i == 1020)  Var2$ ="OK OKLAHOMA"
  469. ELSE IF(i == 1021)  Var2$ ="AR-Little Rock"
  470. ELSE IF(i == 1022)  Var2$ ="AR ARKANSAS"
  471.  
  472. finfo1 = FOPEN(2,Var1$)            ;add the selected
  473. fseek(finfo1,0,2)
  474. fwriteln(finfo1,Var2$)            ;state or city to
  475. fclose(finfo1)
  476. var2$ = ""                ;the file
  477. updatedlg(1)                ;display the change to the file in the list box
  478. goto plains_test
  479.  
  480. ;******** Alaska or Hawaii Selected **
  481. ;******** See Comments in Plains Section **
  482. ak_hi:
  483.  
  484. ;STATUSLINE("ALASKA OR HAWAII")
  485. DELOBJECT(0,0,0)
  486. USERWINDOW(5,0,100,16776960)
  487. METABKG(0,0,1,"ak_hi.wmf")
  488.     BUTTON(2028,2658,1258,608,"1003,Honolulu")
  489.     BUTTON(7248,4987,1258,608,"1001,&Anchorage")
  490.     BUTTON(2689,405,408,608,"1004,HI")
  491.     BUTTON(7657,3443,409,608,"1002,AK")
  492. SHOW(6)
  493.  
  494.    DIALOGBOX 20, 120, 166, 71, 28, "States and Metros"
  495.       LTEXT 30, 4, 108, 8, "States and Metros Selected"
  496.       FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$
  497.       PUSHBUTTON 107, 32, 49, 14, "Remove "
  498.       PUSHBUTTON 108, 50, 49, 14, "USA Map"
  499.    DEND
  500.  
  501. akhi_test:
  502. dg = dialog?
  503. i = OBJECT?
  504. if(i>0) GOTO get_HS4
  505. if(dg==255) GOTO akhi_test
  506. if(dg==200){
  507.         updatedlg(0)
  508.         GOTO akhi_test
  509. }
  510. if(dg==2){
  511.     gosub remove
  512.     GOTO akhi_test
  513. }
  514. Destroydlg
  515. GOTO USA
  516.  
  517. get_HS4:
  518. IF(i == 1001) Var2$ ="AK-Anchorage"
  519. ELSE IF(i == 1002)  Var2$ ="AK ALASKA"
  520. ELSE IF(i == 1003)  Var2$ ="HI-Honolulu"
  521. ELSE IF(i == 1004)  Var2$ ="HI HAWAII"
  522.  
  523. finfo1 = FOPEN(2,Var1$)            ;add the selected
  524. fseek(finfo1,0,2)
  525. fwriteln(finfo1,Var2$)            ;state or city to
  526. fclose(finfo1)
  527. var2$ = ""                ;the file
  528. updatedlg(1)                ;display the change to the file in the list box
  529. GOTO  akhi_test
  530.  
  531. ;******* North East Region Selected **
  532. ;******* See Comments in Plains Section **
  533. NE:
  534. DELOBJECT(0,0,0)
  535. USERWINDOW(5,0,100,16776960)
  536. METABKG(0,0,1,"ne.wmf")
  537.     BUTTON(7893,4709,1258,607,"1013,Boston")
  538.     BUTTON(4403,5241,1257,607,"1001,&Buffalo")
  539.     BUTTON(4340,8000,1431,608,"1005,Philadelphia")
  540.     BUTTON(2453,7595,1257,608,"1004,Pittsburgh")
  541.     BUTTON(6557,6532,1257,607,"1008,Hartford")
  542.     BUTTON(6399,7316,1573,608,"1002,New York City")
  543.     BUTTON(7862,6127,1257,607,"1010,Providence")
  544.     BUTTON(7091,5063,425,608,"1012,MA")
  545.     BUTTON(8286,1899,425,607,"1016,ME")
  546.     BUTTON(5676,4380,456,607,"1003,NY")
  547.     BUTTON(4308,7139,362,608,"1006,PA")
  548.     BUTTON(5802,7291,472,608,"1007,NJ")
  549.     BUTTON(6352,5848,472,608,"1009,CT")
  550.     BUTTON(7421,5899,362,607,"1011,RI")
  551.     BUTTON(7138,4127,441,607,"1015,NH")
  552.     BUTTON(6494,4101,456,608,"1014,VT")
  553. SHOW(6)
  554.  
  555.    DIALOGBOX 18, 14, 166, 71, 28, "States and Metros"
  556.       LTEXT 30, 4, 108, 8, "States and Metros Selected"
  557.       FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$
  558.       PUSHBUTTON 107, 32, 49, 14, "Remove "
  559.       PUSHBUTTON 107, 50, 49, 14, "USA Map"
  560.    DEND
  561.  
  562. NE_test:
  563. dg = dialog?
  564. i = OBJECT?
  565. if(i>0) GOTO  get_HS7
  566. if(dg==255) GOTO  NE_test
  567. if(dg==200){
  568.         updatedlg(0)
  569.         GOTO ne_test
  570. }
  571. if(dg==2){
  572.     gosub remove
  573.     GOTO ne_test
  574. }
  575. Destroydlg
  576.  
  577. GOTO USA
  578.  
  579. get_HS7:
  580. IF(i == 1001) Var2$ ="NY-Buffalo"
  581. ELSE IF(i == 1002) Var2$ = "NY-New York City"
  582. ELSE IF(i == 1003) Var2$ = "NY NEW YORK"
  583. ELSE IF(i == 1004) Var2$ = "PA-Pittsburgh"
  584. ELSE IF(i == 1005) Var2$ = "PA-Philadelphia"
  585. ELSE IF(i == 1006) Var2$ = "PA PENNSYLVANIA"
  586. ELSE IF(i == 1007) Var2$ = "NJ NEW JERSEY"
  587. ELSE IF(i == 1008) Var2$ = "CT-Hartford"
  588. ELSE IF(i == 1009) Var2$ = "CT CONNECTICUT"
  589. ELSE IF(i == 1010) Var2$ = "RI-Providence"
  590. ELSE IF(i == 1011) Var2$ = "RI RHODE ISLAND"
  591. ELSE IF(i == 1012) Var2$ = "MA MASSACHUSETTS"
  592. ELSE IF(i == 1013) Var2$ = "MA-Boston"
  593. ELSE IF(i == 1014) Var2$ = "VT VERMONT"
  594. ELSE IF(i == 1015) Var2$ = "NH NEW HAMPSHIRE"
  595. ELSE IF(i == 1016) Var2$ = "ME MAINE"
  596.  
  597. finfo1 = FOPEN(2,Var1$)            ;add the selected
  598. fseek(finfo1,0,2)
  599. fwriteln(finfo1,Var2$)            ;state or city to
  600. fclose(finfo1)
  601. var2$ = ""                ;the file
  602. updatedlg(1)                ;display the change to the file in the list box
  603. GOTO ne_test
  604.  
  605. ;******* Mountain Region Selected **
  606. ;******* See Comments in Plains Section **
  607. MOUNTAIN:
  608. DELOBJECT(0,0,0)
  609. USERWINDOW(5,0,100,16776960)
  610. METABKG(0,0,1,"mountain.wmf")
  611.     BUTTON(2437,1215,1258,608,"1001,&Billings")
  612.     BUTTON(3129,3646,1258,607,"1005,Cheyenne")
  613.     BUTTON(1714,2304,1258,607,"1003,Boise")
  614.     BUTTON(1855,4861,1526,607,"1007,Salt Lake City")
  615.     BUTTON(204,6506,1258,608,"1013,Las Vegas")
  616.     BUTTON(2374,9139,1258,607,"1016,Tucson")
  617.     BUTTON(802,7722,1258,608,"1015,Phoenix")
  618.     BUTTON(3742,7797,1462,608,"1011,Albuquerque")
  619.     BUTTON(3223,5519,1258,608,"1009,Denver")
  620.     BUTTON(3695,2810,472,608,"1006,WY")
  621.     BUTTON(4072,861,472,607,"1002,MT")
  622.     BUTTON(1619,1316,472,608,"1004,ID")
  623.     BUTTON(943,4582,472,608,"1014,NV")
  624.     BUTTON(2390,5595,472,608,"1008,UT")
  625.     BUTTON(2390,7114,472,608,"1017,AZ")
  626.     BUTTON(3381,6911,471,608,"1012,NM")
  627.     BUTTON(4780,5241,472,607,"1010,CO")
  628. SHOW(6)
  629.  
  630.    DIALOGBOX 275, 20, 159, 70, 28, "States and Metros"
  631.       LTEXT 30, 4, 108, 8, "States and Metros Selected"
  632.       FLISTBOX 8, 15, 92, 49, VAR1$, VAR2$
  633.       PUSHBUTTON 103, 22, 49, 14, "Remove "
  634.       PUSHBUTTON 103, 44, 49, 14, "USA Map"
  635.    DEND
  636.  
  637. MOUNTAIN_test:
  638. dg = dialog?
  639. i = OBJECT?
  640. if(i>0) GOTO get_HS9
  641. if(dg==255) GOTO mountain_test
  642. if(dg==200){
  643.         updatedlg(0)
  644.         GOTO mountain_test
  645. }
  646. if(dg==2){
  647.     GOSUB remove
  648.     GOTO mountain_test
  649. }
  650. Destroydlg
  651.  
  652. GOTO usa
  653.  
  654. get_hs9:
  655. IF(i == 1001) Var2$ ="MT-Billings"
  656. ELSE IF(i == 1002)  Var2$ ="MT MONTANA"
  657. ELSE IF(i == 1003)  Var2$ ="ID-Boise"
  658. ELSE IF(i == 1004)  Var2$ ="ID IDAHO"
  659. ELSE IF(i == 1005)  Var2$ ="WY-Cheyenne"
  660. ELSE IF(i == 1006)  Var2$ ="WY WYOMING"
  661. ELSE IF(i == 1007)  Var2$ ="UT-Salt Lake City"
  662. ELSE IF(i == 1008)  Var2$ ="UT UTAH"
  663. ELSE IF(i == 1009)  Var2$ ="CO-Denver"
  664. ELSE IF(i == 1010)  Var2$ ="CO COLORADO"
  665. ELSE IF(i == 1011)  Var2$ ="NM-Albuquerque"
  666. ELSE IF(i == 1012)  Var2$ ="NM NEW MEXICO"
  667. ELSE IF(i == 1013)  Var2$ ="NV-Las Vegas"
  668. ELSE IF(i == 1014)  Var2$ ="NV NEVADA"
  669. ELSE IF(i == 1015)  Var2$ ="AZ-Phoenix"
  670. ELSE IF(i == 1016)  Var2$ ="AZ-Tucson"
  671. ELSE IF(i == 1017)  Var2$ ="AZ ARIZONA"
  672.  
  673. finfo1 = FOPEN(2,Var1$)
  674. fseek(finfo1,0,2)
  675. fwriteln(finfo1,Var2$)
  676. fclose(finfo1)
  677. var2$ = ""
  678. updatedlg(1)
  679. goto MOUNTAIN_test
  680.  
  681.  
  682.  
  683. nope:
  684. alert("To save disk space for Demo purposes, only the Plains, North East, and Mountain Regions are available.")
  685. GOTO us_test
  686.  
  687. ;****** Subroutine to remove the selection in a FLISTBOX ***
  688. remove:
  689.         if(null(var2$) == true)return
  690.         temp = fopen(4096,"temp.txt")
  691.         recfdir = fopen(2,var1$)
  692.         fseek(recfdir,0,0)
  693.         dl_sel$ = freadln(recfdir)
  694.         while(null(dl_sel$) == false)
  695.                 if(cmp(left(dl_sel$,(len(dl_sel$) - 2)),var2$) == true) goto skip
  696.                 fwrite(temp,len(dl_sel$),dl_sel$)
  697.         skip:
  698.         dl_sel$ = freadln(recfdir)
  699.         wend
  700.         var2$ = ""
  701.         fclose(temp)
  702.         fclose(recfdir)
  703.         deletefile(var1$)
  704.         rename("temp.txt",var1$)
  705.         updatedlg(1)
  706.         return
  707.  
  708.     
  709. exit:
  710. DELOBJECT(0,0,0)
  711. DELETEFILE(var1$)    ;finished with the graphic hotspot demo
  712. SHOW(8)            ;show the cleared screen
  713. ENABLEMENU(m1,2,0)    ;re-enable the menu items
  714. ENABLEMENU(m1,3,0)
  715. ENABLEMENU(m1,4,0)
  716. ENABLEMENU(m1,5,0)
  717. ENABLEMENU(m1,6,0)
  718. ENABLEMENU(m1,7,0)
  719. SHOWBAR(m1)
  720. GOTO main_loop            ;go back to menu bar processing
  721.  
  722. end
  723.